package org.shangma.controller;

import org.shangma.common.Account;
import org.shangma.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
//@RequestMapping("account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @GetMapping("/account/{id}")
    public Account findById(@PathVariable("id") int id){
        return accountService.findAccountById(id);
    }

    @PutMapping("account")
    public void reduceMoney(int accountId,double money){
        accountService.reduceMoney(money,accountId);
    }
}
